package org.agile2soft.nexoma.tapestry.pages;



import org.apache.tapestry5.annotations.Property;
import org.apache.tapestry5.ioc.annotations.Inject;

import br.com.arsmachina.module.Module;
import br.com.arsmachina.module.service.ModuleService;
import br.com.arsmachina.tapestrycrud.module.TapestryCrudModule;
import br.com.arsmachina.tapestrycrud.services.TapestryCrudModuleService;

public class ArsMachina
{

    @Inject
    @Property
    private ModuleService moduleService;

    @Property
    private Module module;

    @Inject
    @Property
    private TapestryCrudModuleService tapestryCrudModuleService;

//    public Object go() {
//        moduleService.getEntityClasses();
//        Module m = moduleService.getModules().iterator().next();
//        m.getRootPackage();
//        TapestryCrudModule mCrud = tapestryCrudModuleService.getModules().iterator().next();
//        mCrud.getId();
//        return null;
//    }

    @Property
    private TapestryCrudModule tapestryCrudModule;

    @Property
    private Class<?> entityClass;

    public Object getPrimaryKeyEncoder() {
        return tapestryCrudModule.getPrimaryKeyEncoderClass(entityClass);
    }

    public Object getActivationContextEncoder() {
        return tapestryCrudModule.getActivationContextEncoderClass(entityClass);
    }

    public Object getBeanModelCustomizer() {
        return tapestryCrudModule.getBeanModelCustomizerClass(entityClass);
    }
    public Object getEncoder() {
        return tapestryCrudModule.getEncoderClass(entityClass);
    }

    public Object getLabelEncoder() {
        return tapestryCrudModule.getLabelEncoderClass(entityClass);
    }


    public Object go(){
        tapestryCrudModule.getPrimaryKeyEncoderClass(entityClass);
        tapestryCrudModule.getBeanModelCustomizerClass(entityClass);
        tapestryCrudModule.getEncoderClass(entityClass);
        tapestryCrudModule.getLabelEncoderClass(entityClass);
        tapestryCrudModule.getListPageClass(entityClass);
        tapestryCrudModule.getListPagePrefix();
        tapestryCrudModule.getListPageURL(entityClass);
        tapestryCrudModule.getEditPageClass(entityClass);
        tapestryCrudModule.getEditPagePrefix();
        tapestryCrudModule.getEditPageURL(entityClass);
        tapestryCrudModule.getViewPageClass(entityClass);
        tapestryCrudModule.getViewPagePrefix();
        tapestryCrudModule.getViewPageURL(entityClass);
        return tapestryCrudModule.getActivationContextEncoderClass(entityClass);

    }

}